<?php
	include_once('config.php');
	include_once('SystemOneAPI.php');
	$api_service_list = "http://systemone.uplb.edu.ph/api/auth/";
	$api = new SystemOneAPI($api_service_list, API_USERNAME, API_PASSWORD);
	
	$login_params = array( );
	$login_params['username'] = 'liphedra';
	$login_params['password'] = '0628192';
	//echo $login_params['username'].'<br />'.$login_params['password'].'<br />';
	$result = $api->execute('login', $login_params);
	
	if ($result) {
		$_SESSION['sessionInfo'] = $api->getSessionInfo();
		$api->close();

	} else {
		$error_message = $api->getLastError();
		$api->close();
		echo $error_message;
	}
	
	$service_list="http://202.92.144.6/api/ocm/schedule.php";
	$api1 = new SystemOneAPI($service_list, API_USERNAME, API_PASSWORD);
	$api1->setSessionInfo($_SESSION['sessionInfo']);

	$result = $api1->execute('get_schedule');
	echo $result.courseCode;
	echo "<br/><br/>";
	echo count($result);
	echo "<br/><br/>";
	
	/*
	$schedule = $result->{'schedule'};
		$count1=count($schedule);
		echo "<br/><br/>ENLISTED</br>";
		for($i=0;$i<$count1;$i++){
			echo "<br/>";
			echo $schedule[$i]->courseCode."<br/>"; 
			echo $schedule[$i]->sectionName."<br/>"; 
			echo $schedule[$i]->lecture."<br/>";
			echo $schedule[$i]->laboratory."<br/>"; 
			echo $schedule[$i]->lecturer."<br/>";
			echo $schedule[$i]->instructor."<br/>"; 
			echo $schedule[$i]->units."<br/>";
			echo $schedule[$i]->slotStatus."<br/>"; 
			echo $schedule[$i]->sectionStatus."<br/>";
			echo $schedule[$i]->isLargeClass."<br/>";
			echo "<br/><br/>";
		}
	*/
	
	//echo print_r($result);
	$api->close();
?>